Skip to content

fix(cli): prisma-next init/plan/impl crash + stash-prisma-next skill (rc.2 M1)#683

Merged
coderdan merged 3 commits into
mainfrom
feat/prisma-next-cli-skill
Jul 18, 2026
Merged

fix(cli): prisma-next init/plan/impl crash + stash-prisma-next skill (rc.2 M1)#683
coderdan merged 3 commits into
mainfrom
feat/prisma-next-cli-skill

Conversation

@coderdan

@coderdan coderdan commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What

Companion to #655. #655 releases the @cipherstash/prisma-next EQL v3 package but touches no CLI code — so the CLI-side Prisma Next experience is still broken. This PR fixes it:

  • The M1 crash. SKILL_MAP is typed Record<Integration, …> but omitted the 'prisma-next' key. installSkills and the AGENTS.md builder do SKILL_MAP[integration]undefinednot iterable for any repo the CLI detects as Prisma Next. tsc catches the missing key, but the build (tsup) transpiles without type-checking, so it shipped in rc.2 — reachable by any Prisma user running stash init (Prisma Next is auto-detected via detectPrismaNext).
  • New stash-prisma-next skill documenting the EQL v3 surface: domain-named column types (EncryptedTextSearch, EncryptedDoubleOrd, …), cipherstashFromStackV3 wiring, the runtime value envelopes, the eql* query operators, and EQL install via prisma-next migration apply (not stash eql install). Authored from Feat/prisma next eql v3 #655's converted example app and package README, so it reflects the real v3 API.

How

  • Add the prisma-next SKILL_MAP entry (stash-encryption, stash-prisma-next, stash-cli).
  • Route both consumers through a new skillsFor() helper that degrades an unmapped integration to the base skill set instead of crashing — belt-and-braces for the next Integration variant, since tsup won't type-check the map. (The real gap it papers over: the CLI package has no tsc --noEmit gate in CI.)
  • Meta files: AGENTS.md skill-map table + skills list.

Tests

  • SKILL_MAP has a non-empty entry for every integration (the runtime guard tsc can't be in this build).
  • skillsFor() falls back for an unmapped integration.
  • buildAgentsMdBody('prisma-next', 'doctrine-plus-skills') inlines the skill — the exact call that used to throw not iterable.
  • installSkills(…, 'prisma-next') copies stash-prisma-next/SKILL.md (verified end-to-end).
  • Full CLI suite 502 green, code:check clean.

Ordering

Stacked on feat/prisma-next-eql-v3 so the skill reflects the released v3 API; retarget to main when #655 lands (GitHub does this automatically). The skill defers stash env flag detail to the stash-cli skill so it's correct regardless of #682's merge order.

Closes the rc.2 M1 finding.

https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

Summary by CodeRabbit

  • New Features
    • Added Prisma Next integration support, including a dedicated skill guide and generated project guidance.
    • Added Prisma Next detection to prevent unsupported standalone EQL installation.
    • Added actionable guidance to use prisma-next migration apply, with --force available when appropriate.
  • Bug Fixes
    • Prevented stash init, stash plan, and stash impl from crashing in Prisma Next projects.
    • Added safe fallback behavior for integrations without mapped skills.

@coderdan
coderdan requested a review from a team as a code owner July 17, 2026 06:20
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 65da67c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
stash Minor
@cipherstash/basic-example Patch
@cipherstash/e2e Patch
@cipherstash/stack Minor
@cipherstash/stack-drizzle Minor
@cipherstash/stack-supabase Minor
@cipherstash/prisma-next Minor
@cipherstash/wizard Minor
@cipherstash/bench Patch
@cipherstash/test-kit Patch
@cipherstash/prisma-next-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Prisma Next skill resolution and documentation, prevents standalone EQL installation in Prisma Next projects unless forced, and adds unit and end-to-end coverage for skill generation and install guarding.

Changes

Prisma Next integration

Layer / File(s) Summary
Skill mapping and generated guidance
packages/cli/src/commands/init/lib/*
Adds the prisma-next skill mapping, safe fallback resolution, generated agent guidance, and regression tests for mapped and unmapped integrations.
Prisma Next EQL install guard
packages/cli/src/commands/db/install.ts, packages/cli/src/messages.ts, packages/cli/src/commands/db/__tests__/*, packages/cli/tests/e2e/*
Detects Prisma Next projects before installation, emits migration guidance, supports --force, and tests command behavior.
Prisma Next skill and release metadata
skills/stash-prisma-next/SKILL.md, AGENTS.md, .changeset/*
Documents Prisma Next EQL v3 setup, runtime usage, operators, authentication, packaging, installation, and related release guidance.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

  • Issue 690 — Both changes update Prisma Next EQL installation guidance from stash eql install to migration-based installation.

Possibly related PRs

Suggested reviewers: calvinbrewer

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main fix: Prisma Next CLI crash handling and the new stash-prisma-next skill.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/prisma-next-cli-skill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a CLI crash when stash init/plan/impl detects a Prisma Next project by adding the missing prisma-next skills mapping, and introduces a new shipped agent skill documenting the Prisma Next EQL v3 surface.

Changes:

  • Add prisma-next to the CLI init SKILL_MAP and route skill resolution via a new resilient skillsFor() helper.
  • Inline/install the new stash-prisma-next skill during AGENTS.md building and skills installation, with regression tests for the prior “not iterable” crash.
  • Update repo meta docs and add a changeset to ship the new skill + fix.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
skills/stash-prisma-next/SKILL.md New Prisma Next EQL v3 integration skill content (schema types, runtime wiring, operators, migrations).
packages/cli/src/commands/init/lib/install-skills.ts Adds prisma-next mapping and skillsFor() fallback used by both installers and AGENTS.md builder.
packages/cli/src/commands/init/lib/build-agents-md.ts Switches skill inlining to use skillsFor() instead of direct SKILL_MAP indexing.
packages/cli/src/commands/init/lib/tests/install-skills.test.ts Adds tests ensuring all integrations have non-empty skills; tests skillsFor() fallback + prisma-next mapping.
packages/cli/src/commands/init/lib/tests/build-agents-md.test.ts Adds regression test ensuring prisma-next inlines the new skill (and doesn’t crash).
AGENTS.md Updates the published skill list and mapping table to include stash-prisma-next.
.changeset/stash-prisma-next-skill.md Changeset describing the CLI crash fix and new shipped skill.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skills/stash-prisma-next/SKILL.md Outdated
Comment thread skills/stash-prisma-next/SKILL.md Outdated
Comment thread packages/cli/src/commands/init/lib/install-skills.ts Outdated
Comment thread skills/stash-prisma-next/SKILL.md
Comment thread skills/stash-prisma-next/SKILL.md
Comment thread skills/stash-prisma-next/SKILL.md Outdated
Comment thread skills/stash-prisma-next/SKILL.md
Comment thread skills/stash-prisma-next/SKILL.md
Comment thread skills/stash-prisma-next/SKILL.md
coderdan added a commit that referenced this pull request Jul 17, 2026
…#683

- init does NOT scaffold wiring for Prisma Next (it skips the
  encryption-client scaffold — schema is derived from contract.json);
  say so instead of 'scaffolds the wiring'. (Copilot)
- eqlAsc/eqlDesc are free functions taking the column expression
  (eqlAsc(u.salary)), not zero-arg methods; fix the ORDER BY table row
  to match the code example. (Copilot)
- install-skills.ts: the skillsFor regression guard is a test asserting
  SKILL_MAP has an entry for every value in a maintained ALL_INTEGRATIONS
  list, not one that reads the provider registry; correct the comment. (Copilot)

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
coderdan added a commit that referenced this pull request Jul 17, 2026
Prisma Next installs the EQL bundle through its own migration ledger
(migrations/cipherstash/ applied by `prisma-next migration apply`), so the
standalone installer is the wrong tool — running it applies EQL out-of-band
from the framework's ledger. `stash init --prisma-next` already skips the
installer; this closes the manual-invocation hole.

- New pure `prismaNextInstallGuard(cwd, { force })` (mirrors
  validateInstallFlags): returns actionable guidance when a Prisma Next
  project is detected and --force isn't set, else null. Called early in
  installCommand, before any DB I/O — fails fast with a pointer to
  `prisma-next migration apply`.
- --force overrides (deliberate standalone install escape hatch).
- messages.eql.prismaNextDetected as the stable leader.
- Tests: 4 unit (config-file detection, dep detection, --force override,
  non-prisma-next passthrough) + 1 pty-less e2e proving the wiring (refuses,
  exit 1, no DB). Skill gotcha + changeset updated.

Addresses CJ/Dan's #683 review ask to enforce this in the CLI.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
@coderdan
coderdan force-pushed the feat/prisma-next-eql-v3 branch 2 times, most recently from 4c7abac to 8db7196 Compare July 18, 2026 10:22
Base automatically changed from feat/prisma-next-eql-v3 to main July 18, 2026 10:38
coderdan added 3 commits July 18, 2026 20:40
…sma-next skill

SKILL_MAP was typed Record<Integration, ...> but omitted the 'prisma-next'
key, so installSkills and the AGENTS.md builder hit SKILL_MAP['prisma-next']
= undefined and threw 'not iterable' for any repo the CLI detected as Prisma
Next. tsc catches the missing key, but the build (tsup) transpiles without
type-checking, so the error shipped in rc.2 — reachable by any Prisma user
running stash init (Prisma Next is auto-detected).

- Add the prisma-next SKILL_MAP entry.
- Route both consumers through a new skillsFor() helper that degrades an
  unmapped integration to the base skill set (stash-encryption + stash-cli)
  instead of crashing — belt-and-braces for the next Integration variant,
  since tsup won't type-check the map.
- New skills/stash-prisma-next/SKILL.md documenting the EQL v3 Prisma Next
  surface: domain-named column types (EncryptedTextSearch, EncryptedDoubleOrd,
  ...), cipherstashFromStackV3 wiring, runtime envelopes, the eql* operators,
  and EQL install via prisma-next migration apply (not stash eql install).
- Tests: SKILL_MAP has a non-empty entry for every integration; skillsFor
  falls back for an unmapped one; buildAgentsMdBody('prisma-next', ...) inlines
  the skill (the exact call that used to crash); installSkills copies it.
- Meta: AGENTS.md skill-map table + skills list updated.

Companion to #655 (the @cipherstash/prisma-next EQL v3 package) — that PR
releases the package but touches no CLI code, so this crash survives it.
Stacked on feat/prisma-next-eql-v3; retarget to main when #655 lands.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
…#683

- init does NOT scaffold wiring for Prisma Next (it skips the
  encryption-client scaffold — schema is derived from contract.json);
  say so instead of 'scaffolds the wiring'. (Copilot)
- eqlAsc/eqlDesc are free functions taking the column expression
  (eqlAsc(u.salary)), not zero-arg methods; fix the ORDER BY table row
  to match the code example. (Copilot)
- install-skills.ts: the skillsFor regression guard is a test asserting
  SKILL_MAP has an entry for every value in a maintained ALL_INTEGRATIONS
  list, not one that reads the provider registry; correct the comment. (Copilot)

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
Prisma Next installs the EQL bundle through its own migration ledger
(migrations/cipherstash/ applied by `prisma-next migration apply`), so the
standalone installer is the wrong tool — running it applies EQL out-of-band
from the framework's ledger. `stash init --prisma-next` already skips the
installer; this closes the manual-invocation hole.

- New pure `prismaNextInstallGuard(cwd, { force })` (mirrors
  validateInstallFlags): returns actionable guidance when a Prisma Next
  project is detected and --force isn't set, else null. Called early in
  installCommand, before any DB I/O — fails fast with a pointer to
  `prisma-next migration apply`.
- --force overrides (deliberate standalone install escape hatch).
- messages.eql.prismaNextDetected as the stable leader.
- Tests: 4 unit (config-file detection, dep detection, --force override,
  non-prisma-next passthrough) + 1 pty-less e2e proving the wiring (refuses,
  exit 1, no DB). Skill gotcha + changeset updated.

Addresses CJ/Dan's #683 review ask to enforce this in the CLI.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
@coderdan
coderdan force-pushed the feat/prisma-next-cli-skill branch from 29d0ea5 to 65da67c Compare July 18, 2026 10:41
coderdan added a commit that referenced this pull request Jul 18, 2026
…s; cipherstashFromStackV3 -> cipherstashFromStack

Aligns the EQL v3 authoring surface with the stack / Drizzle types.* catalog
(the cipherstash. namespace already disambiguates):

- v3 PSL column constructors drop the Encrypted prefix, at the single
  derivation seam (contract-authoring.ts v3PascalName): EncryptedTextSearch
  -> TextSearch, EncryptedDoubleOrd -> DoubleOrd, EncryptedBoolean -> Boolean,
  EncryptedJson -> Json, etc.
- v3 one-call setup: cipherstashFromStackV3 -> cipherstashFromStack (v3 is the
  default); the v2 setup fn becomes cipherstashFromStackV2.

Deliberately unchanged:
- runtime value envelopes (EncryptedString/Number/BigInt/Date/Boolean/Json) —
  a separate write-side surface; Dan asked to leave them as-is.
- the cipherstash.*V2 legacy column constructors.
- generated contract.json + codec ids (they key off codecIds, not constructor
  names — so no contract regeneration needed, which sidesteps the broken
   on this branch).
- the eql* query operators.
- camelCase TS-authoring exports (encryptedTextSearch, …) keep their prefix for
  now — a follow-up will align them (kept v3CamelName unchanged to avoid
  desyncing the static exports).

Namespace stays cipherstash (not eql): it is the extension's vendor identity
(CIPHERSTASH_SPACE_ID, woven through every cipherstash/eql-v3/* codec id and
cipherstash:* invariant) — switching it would re-identify the whole extension.

Updated: example schema.prisma + db.ts + e2e, both READMEs, the
stash-prisma-next skill, and the authoring/psl-interpretation tests. Verified:
package builds clean, bundling-isolation 12/12, authoring/psl/column-types/
from-stack suites green, code:check clean. (Pre-existing env failures — live
tests, properties, migration-v3 — are missing-devdep/DB issues, not this change.)

Stacked on #683. v2 name per Dan; namespace + scope calls documented above.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Line 95: Update SECURITY.md to include the package associated with the newly
listed stash-prisma-next skill, keeping its package list consistent with the
skills catalog in AGENTS.md.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 805a1c7b-8e35-4ec2-9f46-2b73f1fb38be

📥 Commits

Reviewing files that changed from the base of the PR and between a75513b and 65da67c.

📒 Files selected for processing (11)
  • .changeset/stash-prisma-next-skill.md
  • AGENTS.md
  • packages/cli/src/commands/db/__tests__/prisma-next-install-guard.test.ts
  • packages/cli/src/commands/db/install.ts
  • packages/cli/src/commands/init/lib/__tests__/build-agents-md.test.ts
  • packages/cli/src/commands/init/lib/__tests__/install-skills.test.ts
  • packages/cli/src/commands/init/lib/build-agents-md.ts
  • packages/cli/src/commands/init/lib/install-skills.ts
  • packages/cli/src/messages.ts
  • packages/cli/tests/e2e/eql-install-prisma-next.e2e.test.ts
  • skills/stash-prisma-next/SKILL.md

Comment thread AGENTS.md
@coderdan

Copy link
Copy Markdown
Contributor Author

Human and I review (Copilot, Coderabbit and Claude/Opus).

@coderdan
coderdan merged commit 8872d1e into main Jul 18, 2026
11 checks passed
@coderdan
coderdan deleted the feat/prisma-next-cli-skill branch July 18, 2026 12:01
coderdan added a commit that referenced this pull request Jul 18, 2026
…s; cipherstashFromStackV3 -> cipherstashFromStack

Aligns the EQL v3 authoring surface with the stack / Drizzle types.* catalog
(the cipherstash. namespace already disambiguates):

- v3 PSL column constructors drop the Encrypted prefix, at the single
  derivation seam (contract-authoring.ts v3PascalName): EncryptedTextSearch
  -> TextSearch, EncryptedDoubleOrd -> DoubleOrd, EncryptedBoolean -> Boolean,
  EncryptedJson -> Json, etc.
- v3 one-call setup: cipherstashFromStackV3 -> cipherstashFromStack (v3 is the
  default); the v2 setup fn becomes cipherstashFromStackV2.

Deliberately unchanged:
- runtime value envelopes (EncryptedString/Number/BigInt/Date/Boolean/Json) —
  a separate write-side surface; Dan asked to leave them as-is.
- the cipherstash.*V2 legacy column constructors.
- generated contract.json + codec ids (they key off codecIds, not constructor
  names — so no contract regeneration needed, which sidesteps the broken
   on this branch).
- the eql* query operators.
- camelCase TS-authoring exports (encryptedTextSearch, …) keep their prefix for
  now — a follow-up will align them (kept v3CamelName unchanged to avoid
  desyncing the static exports).

Namespace stays cipherstash (not eql): it is the extension's vendor identity
(CIPHERSTASH_SPACE_ID, woven through every cipherstash/eql-v3/* codec id and
cipherstash:* invariant) — switching it would re-identify the whole extension.

Updated: example schema.prisma + db.ts + e2e, both READMEs, the
stash-prisma-next skill, and the authoring/psl-interpretation tests. Verified:
package builds clean, bundling-isolation 12/12, authoring/psl/column-types/
from-stack suites green, code:check clean. (Pre-existing env failures — live
tests, properties, migration-v3 — are missing-devdep/DB issues, not this change.)

Stacked on #683. v2 name per Dan; namespace + scope calls documented above.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
coderdan added a commit that referenced this pull request Jul 18, 2026
…ipherstashFromStackV3 → cipherstashFromStack (#685)

* refactor(prisma-next)!: drop Encrypted prefix from v3 PSL constructors; cipherstashFromStackV3 -> cipherstashFromStack

Aligns the EQL v3 authoring surface with the stack / Drizzle types.* catalog
(the cipherstash. namespace already disambiguates):

- v3 PSL column constructors drop the Encrypted prefix, at the single
  derivation seam (contract-authoring.ts v3PascalName): EncryptedTextSearch
  -> TextSearch, EncryptedDoubleOrd -> DoubleOrd, EncryptedBoolean -> Boolean,
  EncryptedJson -> Json, etc.
- v3 one-call setup: cipherstashFromStackV3 -> cipherstashFromStack (v3 is the
  default); the v2 setup fn becomes cipherstashFromStackV2.

Deliberately unchanged:
- runtime value envelopes (EncryptedString/Number/BigInt/Date/Boolean/Json) —
  a separate write-side surface; Dan asked to leave them as-is.
- the cipherstash.*V2 legacy column constructors.
- generated contract.json + codec ids (they key off codecIds, not constructor
  names — so no contract regeneration needed, which sidesteps the broken
   on this branch).
- the eql* query operators.
- camelCase TS-authoring exports (encryptedTextSearch, …) keep their prefix for
  now — a follow-up will align them (kept v3CamelName unchanged to avoid
  desyncing the static exports).

Namespace stays cipherstash (not eql): it is the extension's vendor identity
(CIPHERSTASH_SPACE_ID, woven through every cipherstash/eql-v3/* codec id and
cipherstash:* invariant) — switching it would re-identify the whole extension.

Updated: example schema.prisma + db.ts + e2e, both READMEs, the
stash-prisma-next skill, and the authoring/psl-interpretation tests. Verified:
package builds clean, bundling-isolation 12/12, authoring/psl/column-types/
from-stack suites green, code:check clean. (Pre-existing env failures — live
tests, properties, migration-v3 — are missing-devdep/DB issues, not this change.)

Stacked on #683. v2 name per Dan; namespace + scope calls documented above.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

* fix(prisma-next): complete the camelCase rename — pascal/camel must agree

CI (Node 22/24 unit job) caught what my local env masked: test/v3/properties.test.ts
asserts the PSL (pascal) and TS-authoring (camel) constructor names agree modulo
first-letter case. My earlier deferral of the camelCase exports broke that
invariant (pascal 'TextSearch' vs camel 'encryptedTextSearch'), and the property
test only runs with fast-check installed (absent locally, present in CI).

- v3CamelName drops the prefix too (encrypted<Core> -> lowercase-first<Core>),
  restoring the pascal/camel invariant.
- The 31 static TS-authoring exports rename in lockstep: encryptedTextSearch ->
  textSearch, encryptedDoubleOrd -> doubleOrd, encryptedBoolean -> boolean, etc.
  (column-types.ts + its two test consumers). The v2 encryptedStringV2 descriptors
  and the runtime encrypted*ParamsSchema arktype schemas are deliberately untouched.
- properties.test.ts: the assertion updated to the new convention (name does NOT
  start with 'Encrypted', is PascalCase, camel = lowercase-first(pascal)).
- Changeset updated: camelCase exports move with the PSL names (no longer deferred).

Ran the FULL prisma-next suite locally after `pnpm install` (which restored the
missing devdeps my earlier local runs lacked): 599 passed / 30 skipped, including
properties + column-types. Build clean, code:check clean.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

* test(prisma-next): update negative factory assertions to new-convention names

Follow-up to the camelCase rename: the 'no *OrdOre / no string factory'
negative assertions checked old-convention names (encryptedBigIntOrdOre,
encryptedString) that never existed either way — pass, but off-convention.
Now check the new-convention names (bigIntOrdOre, textOrdOre, string).

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

* docs(prisma-next): fix stale pre-rename names in messages, comments, README

Copilot review on #685 — the rename left several references pointing at the
old constructor names:

- from-stack-v3.ts / from-stack.ts: the "no columns found" errors told users to
  declare `cipherstash.Encrypted*()` — now `cipherstash.*()` (e.g.
  `cipherstash.TextSearch()`) for v3 and `cipherstash.Encrypted*V2()` for v2.
- contract-authoring.ts: the constructor-name doc said `Encrypted<Stem><Suffix>`;
  the prefix is dropped now (`eql_v3_bigint_ord` → `BigIntOrd`).
- bundling-isolation.test.ts: the marker-collision note had the substring
  direction backwards post-rename — `cipherstashFromStackV2` is NOT a substring
  of the v3 `cipherstashFromStack`; the hazard is now the reverse.
- README Quick start: the v3 schema example was wired to the v2 setup
  (`cipherstashFromStackV2` from `/stack`); use `cipherstashFromStack` from
  `/v3` so the snippet actually runs against a v3 contract.

No behavioural change. prisma-next build + 599 tests green.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
coderdan added a commit that referenced this pull request Jul 18, 2026
…shipped

Dan's review on #691: the `stash eql migration --prisma` copy said the flag
"ships with prisma-next EQL v3 support" / "not available yet" — but that support
has shipped (#655/#683/#685), and Prisma Next installs EQL v3 through its OWN
migration system (`prisma-next migration apply`), not through this command.

Reframed all five spots to current reality (not "coming soon", but "use
prisma-next migration apply"): the user-facing message + its doc comment, the
`eqlMigrationCommand` code comment, the `--prisma` flag help in the registry,
the changeset, and the stash-cli skill (which ships to customers).

No behaviour change — `--prisma` still fails with a pointer. Build + 566 tests green.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
coderdan added a commit that referenced this pull request Jul 18, 2026
…QL install) (#691)

* feat(cli): add `stash eql migration --drizzle` (v3, migration-first EQL install)

First of the three PRs in #690: make migration-first, ORM-agnostic EQL v3 install
the front door, so every integration sources install SQL from one place (the CLI's
bundled variants) instead of vendoring its own. This is the pattern that keeps
Drizzle Supabase-safe; prisma-next's superuser-on-Supabase failure is fixed by the
stacked follow-ups (`--prisma` emitter + removing prisma-next's baked baseline),
which land on top of the prisma-next EQL v3 work (#655).

`stash eql migration --drizzle [--supabase] [--name] [--out] [--dry-run]`:
- Generates a Drizzle custom migration (via `drizzle-kit generate --custom`, then
  injects the SQL) carrying the bundled EQL **v3** install script + the
  `cs_migrations` tracking schema — one `drizzle-kit migrate` does everything
  `stash encrypt …` needs.
- `--supabase` appends the v3 role grants (`eql_v3` + `eql_v3_internal` →
  anon/authenticated/service_role), matching `stash eql install --supabase`.
- v3 only — no `--eql-version` (prisma-next never shipped v2).
- `--prisma` is registered but fails with a pointer to #690 until the stacked PR.

The SQL assembly (`buildEqlV3MigrationSql`) is a pure, unit-tested function; the
drizzle-kit scaffold/inject orchestration reuses the proven helpers from the v2
`install --drizzle` path (`findGeneratedMigration`, `cleanupMigrationFile`, now
exported). Registry + dispatch + help + `stash-cli`/`stash-drizzle` skills updated.

Tests: 4 new unit (bundle present, grants gated on --supabase, tracking schema),
544 CLI unit green, manifest resolves the command, biome clean. Changeset: stash minor.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

* fix(cli): harden `stash eql migration` per review (#691)

Addresses the review on #691 — correctness, security, telemetry, and coverage:

- Run the PROJECT-LOCAL drizzle-kit (`pnpm exec` / `npx --no-install`), not the
  `pnpm dlx`/`yarn dlx` download-and-run form, so it resolves the project's own
  drizzle.config.ts + schema. New shared `execCommand`/`execArgv` in init/utils
  (setup-prompt's private copy folded in).
- Invoke via `spawnSync` with an argv array instead of `execSync` on a shell
  string — a `--name` with spaces or shell metacharacters is now one inert token
  (no word-splitting, no command injection). Plus a `[\w-]+` name guard.
- Pass `--out` through to `drizzle-kit generate` (always) so the flag actually
  steers where the migration is written, and our lookup can't miss it.
- Validation exits and every abort throw `CliExit(1)` instead of `process.exit`,
  so the telemetry `finally` runs and the branches are unit-testable.
- Guard `loadBundledEqlSql` (corrupt bundle → clean error, not a fatal trace),
  add the missing `p.intro`, and call `printNextSteps()` so the now-preferred
  install path isn't less helpful than `eql install`.
- HELP banner lists `eql migration`.

Tests: 14 migration unit (target selection incl. `--supabase`-alone, name guard,
dry-run, argv threading, non-zero drizzle-kit, write-failure cleanup, SQL order),
3 `findGeneratedMigration` unit (now public API), e2e smoke + `eql migration
--help`. 557 unit / 65 e2e green, code:check clean.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

* fix(cli): bun exec must not surprise-download; drop type-erased test cast

CodeRabbit review on #691:

- `execArgv`/`execCommand` bun case emitted `bun x`, which auto-installs a
  missing binary from npm — contradicting the "run a project-local binary,
  never surprise-download" contract these helpers exist to honour (the npm case
  already passes `--no-install`). Bun supports `--no-install`; pass it for both
  the argv and shell forms. Updated the setup-prompt assertion to match.
- migration.test.ts: replaced the type-erasing `undefined as unknown as
  writeFileSync` hoisted-mock placeholder with a throwing placeholder cast to the
  specific type — fails loud if the mock factory never runs, and drops the
  `as unknown` (test files are plugin-exempt, but this is cleaner).

CLI build + 566 unit tests green; biome clean.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

* docs(cli): correct stale `--prisma` copy now that prisma-next v3 has shipped

Dan's review on #691: the `stash eql migration --prisma` copy said the flag
"ships with prisma-next EQL v3 support" / "not available yet" — but that support
has shipped (#655/#683/#685), and Prisma Next installs EQL v3 through its OWN
migration system (`prisma-next migration apply`), not through this command.

Reframed all five spots to current reality (not "coming soon", but "use
prisma-next migration apply"): the user-facing message + its doc comment, the
`eqlMigrationCommand` code comment, the `--prisma` flag help in the registry,
the changeset, and the stash-cli skill (which ships to customers).

No behaviour change — `--prisma` still fails with a pointer. Build + 566 tests green.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w

* docs(cli): correct `--prisma` copy to match #690 (planned emitter, not "use prisma-next")

My previous pass framed `--prisma` as "not supported — use `prisma-next
migration apply`", which contradicts #690: the `--prisma` emitter IS a planned
follow-up (PR3) that writes the install migration in the framework `Migration`
shape and lets prisma-next DROP its baked install baseline. Pointing users at
`prisma-next migration apply` is the very approach #690 replaces.

Reframe all five spots to "not available yet — the Prisma Next emitter is a
follow-up tracked in #690; use `--drizzle` today": the message + its doc comment,
the `eqlMigrationCommand` code comment, the `--prisma` flag help, the changeset,
and the stash-cli skill. (The `stash eql install` guard + stash-prisma-next skill
keep their `prisma-next migration apply` wording — that correctly describes the
current baked-baseline install, which is a different thing from this CLI emitter.)

No behaviour change. Build + 566 tests green.

Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants